import 'package:fluent_ui/fluent_ui.dart';
import 'package:flutter/services.dart';

Widget windowsClearTextField(
    {required TextEditingController textEditingController,
    required Widget child}) {
  return KeyboardListener(
      focusNode: FocusNode(),
      onKeyEvent: (event) {
        if (event.physicalKey.debugName == LogicalKeyboardKey.backspace) {
          String originalString = textEditingController.text;
          if (originalString.isNotEmpty) {
            textEditingController.text =
                originalString.substring(0, originalString.length - 1);
          }
        }
      },
      child: child);
}
